<%@page import="com.wre.dto.*"%>
<%@page import="com.wre.dao.PropertyTypeDao"%>
<%@page import="com.wre.factory.PropertyTypeDaoFactory"%>
<%@page import="com.wre.factory.AddressDaoFactory"%>
<%@page import="com.wre.dao.AddressDao"%>
<%@page import="java.util.List"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Search Property List </title>
<link href="default.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="js/sortable.js"></script>
</head>
<body>

<jsp:include page="/header.jsp" />

<div id="wrapper">
	<!-- start page -->
	<div id="page">
		<jsp:include page="/sideMenuLeft.jsp" />
		<!-- start content -->
		<div id="content">			
			<div class="post">
				<h1 class="title"><a href="#">Search Property List</a></h1>
				<p class="byline"><br ></p>
				<div class="entry">
					<%
	//HttpSession session1=request.getSession();

	//WreUser wreUser=(WreUser)session.getAttribute("user");
	//String userName=(String)wreUser.getEmail();	
	
		
	//if(session == null)
	//{
		//response.sendRedirect("index.jsp");
		//return;
	//}

	String style = "simple";
	String position = "top";
	int maxPageItems = 2;
	int maxIndexPages = 5;
	List list = (List) request.getAttribute("propertyList");
	PropertyTypeDao propertyTypeDao=PropertyTypeDaoFactory.create();	
	AddressDao addressDao=AddressDaoFactory.create();
	
%>

<center><pg:pager items="<%=list.size()%>" index="center"
	maxPageItems="<%=maxPageItems %>" maxIndexPages="<%= maxIndexPages %>"
	isOffset="<%=true %>" export="offset,currentPageNumber=pageNumber"
	scope="request">
	<%-- keep track of preference --%>
	<pg:param name="style" />
	<pg:param name="position" />
	<pg:param name="index" />
	<pg:param name="maxPageItems" />
	<pg:param name="maxIndexPages" />

	<table class="sortable" id="anyid" width="90%" cellspacing="4" cellpadding="4" border="1">

		<tr bgcolor="#FFCE00">
			<td><strong>Property Name</strong></td>
			<td><strong>Property Type</strong></td>
			<td><strong>Location</strong></td>
			<td><strong>Cost (Rs.)</strong></td>			
		</tr>

		<%
			for (int i = 0, l = Math.min(i
								+ maxPageItems, list.size()); i < l; i++) {
		%><pg:item>
			<tr>
				<%
					Property property=(Property)list.get(i);
										out.println("<td><a href='/propertyDetails.jsp?pid="+property.getPropertyId()+"'>"
												+ property.getPropertyName()
												+ "</a></td>");
										out.println("<td>"
												+ propertyTypeDao.findByPrimaryKey(property.getPropertyTypeId()).getPropertyType()
												+ "</td>");
										out.println("<td>" + addressDao.findByPrimaryKey(property.getAddressId()).getCity()
												+ "</td>");
										out.println("<td>"
												+ property.getCost()
												+ "</td>");
				%>
			</tr>
		</pg:item>
		<%
			}
		%>
	</table>
	<hr />

	<pg:index>
		<!--<jsp:include page="/WEB-INF/jsp/alltheweb.jsp" flush="true" />-->
		<!--<jsp:include page="/WEB-INF/jsp/altavista.jsp" flush="true" />-->
		<!--<jsp:include page="/google.jsp" flush="true" /> -->
		<!--<jsp:include page="/WEB-INF/jsp/jsptags.jsp" flush="true" />-->
		<!--<jsp:include page="/WEB-INF/jsp/lycos.jsp" flush="true" />-->
		<!--<jsp:include page="/WEB-INF/jsp/texticon.jsp" flush="true" />-->
		<!--<jsp:include page="/WEB-INF/jsp/yahoo.jsp" flush="true" />-->
		<jsp:include page="/simple.jsp" flush="true" />
	</pg:index>

</pg:pager></center>
				</div>
			</div>
			
		</div>
		<!-- end content -->
		<!-- start sidebars -->
		<jsp:include page="/sideMenuRight.jsp" />
		<!-- end sidebars -->
		<div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end page -->
</div>
<jsp:include page="/footer.jsp" />
</body>
</html>







<%--

<%@page import="com.wre.dto.*"%>
<%@page import="com.wre.dao.PropertyTypeDao"%>
<%@page import="com.wre.factory.PropertyTypeDaoFactory"%>
<%@page import="com.wre.factory.AddressDaoFactory"%>
<%@page import="com.wre.dao.AddressDao"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@page import="java.util.List"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="js/sortable.js"></script>

<title>Search Property List Page</title>
</head>
<body>
<%
	//HttpSession session1=request.getSession();

	//WreUser wreUser=(WreUser)session.getAttribute("user");
	//String userName=(String)wreUser.getEmail();	
	
		
	//if(session == null)
	//{
		//response.sendRedirect("index.jsp");
		//return;
	//}

	String style = "simple";
	String position = "top";
	int maxPageItems = 2;
	int maxIndexPages = 5;
	List list = (List) session.getAttribute("propertyList");
	PropertyTypeDao propertyTypeDao=PropertyTypeDaoFactory.create();	
	AddressDao addressDao=AddressDaoFactory.create();
	
%>

<center><pg:pager items="<%= list.size()%>" index="center"
	maxPageItems="<%= maxPageItems %>" maxIndexPages="<%= maxIndexPages %>"
	isOffset="<%= true %>" export="offset,currentPageNumber=pageNumber"
	scope="request">
	<%-- keep track of preference --%>
	<%--
	<pg:param name="style" />
	<pg:param name="position" />
	<pg:param name="index" />
	<pg:param name="maxPageItems" />
	<pg:param name="maxIndexPages" />

	<table class="sortable" id="anyid" width="90%" cellspacing="4" cellpadding="4" border="1">

		<tr bgcolor="#FFCE00">
			<td><strong>Property Name</strong></td>
			<td><strong>Property Type</strong></td>
			<td><strong>Location</strong></td>
			<td><strong>Cost (Rs.)</strong></td>			
		</tr>

		<%
			for (int i = offset.intValue(), l = Math.min(i
								+ maxPageItems, list.size()); i < l; i++) {
		%><pg:item>
			<tr>
				<%
					Property property=(Property)list.get(i);
										out.println("<td><a href='/propertyDetails.jsp?pid="+property.getPropertyId()+"'>"
												+ property.getPropertyName()
												+ "</a></td>");
										out.println("<td>"
												+ propertyTypeDao.findByPrimaryKey(property.getPropertyTypeId()).getPropertyType()
												+ "</td>");
										out.println("<td>" + addressDao.findByPrimaryKey(property.getAddressId()).getCity()
												+ "</td>");
										out.println("<td>"
												+ property.getCost()
												+ "</td>");
				%>
			</tr>
		</pg:item>
		<%
			}
		%>
	</table>
	<hr />

	<pg:index>
		
		<jsp:include page="/simple.jsp" flush="true" />
	</pg:index>

</pg:pager></center>

</body>
</html>

--%>